function z = convert_matrix2pdist(M)
% Convert matrix of distances to pdist row vector
% Check MATLAB documentation for pdist

N = size(M,1);
z = zeros(1,N*(N-1)/2);

n = 1;
for i = 1 : N
    for j = i+1 : N
        z(n) = M(i,j);
        n = n + 1;
    end
end
